<template>
  <div>
  <el-form size="medium" ref="numberValidateForm" label-width="100px" class="demo-ruleForm">
    <!--      长链接表单-->
    <el-form-item
        size="medium"
        label="长链接"
        prop="age"
        style="margin-bottom: 20px;margin-top: 50px">
      <el-input  style="width: 600px" v-model="form.longLink" autosize placeholder="请输入长链接内容"></el-input>
    </el-form-item>
    <!--      短链接表单-->
    <el-form-item
        size="medium"
        label="短链接">
      <el-input label="最多输入5个字符" maxlength="5" style="width: 600px" v-model="form.id" placeholder="看什么看，越看越短！" ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitForm()" style="width: 100px" >生成</el-button>
    </el-form-item>

  </el-form>
  <vue-qr v-if=flag :text=form.shortLink :size="250" style="margin-left: 280px" colorDark="#4169E1" colorLight="#fff"></vue-qr>
  </div>
</template>

<script>
import {Message} from "element-ui";

export default {
  name: 'Vip',
  data() {
    return {
      flag:false,
      form: {
        id:'',
        longLink:'',
        shortLink:'',
      },
    }
  },
      methods: {
        submitForm() {
          this.postRequest("/link/vip", this.form).then(resp => {
            if(resp.code==200){
              this.flag=true;
            }
            this.shortLink =resp.data;
            Message.success("二维码生成成功")
          })
        },
      },
}
</script>

<style scoped>
</style>
